package com.celesea;

import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

import javax.sql.DataSource;

/**
 * ========================
 * Created with IntelliJ IDEA.
 * User：恒宇少年
 * Date：2017/5/30
 * Time：14:34
 * 码云：http://git.oschina.net/jnyqy
 * ========================
 */
@Configuration
public class DataSourceConfigurer
{


    //书籍数据源
    @Bean(name = "rdbDataSource")
    @Primary//配置该数据源为主数据源
    @Qualifier("rdbDataSource")
    @ConfigurationProperties(prefix = "spring.datasource.mysql")
    public DataSource bookDataSource(){return DataSourceBuilder.create().build();}



}
